package com.thingsgrid.resource.wrapper;

import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import com.thingsgrid.resource.entity.Oss;
import com.thingsgrid.resource.entity.OssVO;
import com.thingsgrid.system.cache.DictCache;

/**
 * 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2019-05-26
 */
public class OssWrapper extends BaseEntityWrapper<Oss, OssVO> {

	public static OssWrapper build() {
		return new OssWrapper();
	}

	@Override
	public OssVO entityVO(Oss oss) {
		OssVO ossVO = BeanUtil.copy(oss, OssVO.class);
		assert ossVO != null;
		String categoryName = DictCache.getValue("oss", oss.getCategory());
		String statusName = DictCache.getValue("yes_no", oss.getStatus());
		ossVO.setCategoryName(categoryName);
		ossVO.setStatusName(statusName);
		return ossVO;
	}

}
